from threading import *

#e = Event()
#v = ''

class child_proc(Thread):
    def __init__(self):
        self.e = Event()
        super(child_proc,self).__init__()
    def run(self):
        v = 0
        for i in range(5):
            self.e.wait()
            self.e.clear()
            v+=1
            print(v,'cleared')
        print('thread exit')
        return 0
    def next_step(self):
        self.e.set()
        print('set')
            
t = child_proc()
t.start()
for i in range(6):
    c= input('>')
    v = c
    #e.set()
    t.next_step()
